package com.bishe.demo.modules.hotel.hotelFacilityAndService.dao;

import com.bishe.demo.modules.hotel.hotelFacilityAndService.entity.HService;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface HServiceDao {
    @Insert("insert into hotel_h_service values(null,#{hServiceName})")
    @Options(useGeneratedKeys = true, keyProperty = "hServiceId", keyColumn = "h_service_id")
    void insertHService(HService hService);

    @Select("select * from hotel_h_service hhs left join hotel_h_service_user hhsu on hhsu.h_service_id=hhs.h_service_id where hhsu.user_id=#{hotelId}")
    List<HService> getHServicesByHotelId(int hotelId);

    @Delete("delete from hotel_h_service where h_service_id=#{hServiceId}")
    void deleteById(int hServiceId);
}
